home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWViews / FWCntrHW.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  22.1 KB  |  667 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCntrHW.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifdef FW_BUILD_WIN
  11.  
  12. #include "FWFrameW.hpp"
  13.  
  14. #ifndef FWHIDNFR_H
  15. #include "FWCntrHW.h"
  16. #endif
  17.  
  18. #ifndef FWSCLBAR_H
  19. #include "FWSclBar.h"
  20. #endif
  21.  
  22. #ifndef FWCLUSTR_H
  23. #include "FWClustr.h"
  24. #endif
  25.  
  26. #ifndef FWFRAME_H
  27. #include "FWFrame.h"
  28. #endif
  29.  
  30. // ----- OS Includes -----
  31.  
  32. #ifndef FWPOINT_H
  33. #include "FWPoint.h"
  34. #endif
  35.  
  36. #ifndef FWCFMRES_H
  37. #include "FWCFMRes.h"
  38. #endif
  39.  
  40. // ----- Foundation Includes -----
  41.  
  42. #ifndef FWSOMENV_H
  43. #include "FWSOMEnv.h"
  44. #endif
  45.  
  46. //========================================================================================
  47. // Runtime Information
  48. //========================================================================================
  49.  
  50. #ifdef FW_BUILD_MAC
  51. #pragma segment fwviews
  52. #endif
  53.  
  54. //========================================================================================
  55. // Global declarations
  56. //========================================================================================
  57.  
  58. WORD WM_ODFGETOBJECT = ::RegisterWindowMessage("Apple:Framework:GetObject");
  59.  
  60. //========================================================================================
  61. // CLASS FW_CPrivWinControlHelper
  62. //========================================================================================
  63.  
  64. FW_DEFINE_CLASS_M0(FW_CPrivWinControlHelper)
  65.  
  66. //----------------------------------------------------------------------------------------
  67. // FW_CPrivWinControlHelper::FW_CPrivWinControlHelper
  68. //----------------------------------------------------------------------------------------
  69.  
  70. FW_CPrivWinControlHelper::FW_CPrivWinControlHelper(Environment* ev,
  71.                                                     const FW_CClassInfo& classInfo,
  72.                                                    FW_CControl* control) :
  73.     fControl(control),
  74.     fHWnd(NULL)
  75. {
  76.     CheckForInitialize(ev, classInfo);
  77. }
  78.  
  79. //----------------------------------------------------------------------------------------
  80. // FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper
  81. //----------------------------------------------------------------------------------------
  82.  
  83. FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper()
  84. {
  85.     ::DestroyWindow(fHWnd);
  86. }
  87.  
  88. //----------------------------------------------------------------------------------------
  89. // FW_CPrivWinControlHelper::CheckForInitialize
  90. //----------------------------------------------------------------------------------------
  91.  
  92. void FW_CPrivWinControlHelper::CheckForInitialize(Environment* ev, const FW_CClassInfo& classInfo)
  93. {
  94.     if (classInfo == FW_TYPEID_FROM_POINTER(this))
  95.         this->Initialize(ev);
  96. }
  97.  
  98. //----------------------------------------------------------------------------------------
  99. // FW_CPrivWinControlHelper::Initialize
  100. //----------------------------------------------------------------------------------------
  101.  
  102. void FW_CPrivWinControlHelper::Initialize(Environment* ev)
  103. {
  104.     RegisterSuperClass(GetSuperClassInfo());
  105.     
  106.     FW_CPlatformPoint wndLocation    = fControl->GetLocation(ev).AsPlatformPoint();
  107.     FW_CPlatformPoint wndSize        = fControl->GetSize(ev).AsPlatformPoint();
  108.     
  109.     fHWnd = CreateHWnd(fControl->GetFrame(ev)->GetShadowWindow(ev), wndLocation, wndSize);
  110. }
  111.  
  112. //----------------------------------------------------------------------------------------
  113. // FW_CPrivWinControlHelper::RegisterSuperClass
  114. //----------------------------------------------------------------------------------------
  115.  
  116. FW_Boolean FW_CPrivWinControlHelper::RegisterSuperClass
  117.         (FW_SPrivWinSuperClassInfo& superClassInfo)
  118. {
  119.     
  120.     FW_Boolean success = FALSE;
  121.     WNDCLASS wc;
  122.     
  123.     if (::GetClassInfo(NULL, superClassInfo.fClassName, &wc))
  124.         success = TRUE;
  125.     else if (::GetClassInfo(NULL, superClassInfo.fOldClassName, &wc))
  126.     {
  127.         superClassInfo.fOldWndProc = wc.lpfnWndProc;
  128.         superClassInfo.fWndExtraBytes = wc.cbWndExtra;
  129.  
  130.         wc.hInstance = FW_gInstance;
  131.         wc.lpszClassName = superClassInfo.fClassName;
  132.         wc.lpfnWndProc = superClassInfo.fWndProc;
  133.         wc.cbWndExtra = superClassInfo.fWndExtraBytes + sizeof(void *);
  134.         wc.style |= CS_GLOBALCLASS;
  135.  
  136.         success = ::RegisterClass(&wc);
  137.     }
  138.     
  139.     if (!success)
  140.         FW_DEBUG_MESSAGE("Unable to register Windows class!");
  141.         
  142.     return success;
  143. }
  144.  
  145. //----------------------------------------------------------------------------------------
  146. // FW_CPrivWinControlHelper::Move
  147. //----------------------------------------------------------------------------------------
  148.  
  149. void FW_CPrivWinControlHelper::Move(const FW_CPlatformPoint& location,
  150.                                      const FW_CPlatformPoint& size)
  151. {
  152.     ::MoveWindow(fHWnd, location.x, location.y, size.x, size.y, TRUE);
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. // FW_CPrivWinControlHelper::SetText
  157. //----------------------------------------------------------------------------------------
  158.  
  159. void FW_CPrivWinControlHelper::SetText(const FW_CString& text)
  160. {
  161.     ::SetWindowText(fHWnd, text);
  162. }
  163.  
  164. //----------------------------------------------------------------------------------------
  165. // FW_CPrivWinControlHelper::GetText
  166. //----------------------------------------------------------------------------------------
  167.  
  168. void FW_CPrivWinControlHelper::GetText(FW_CString& text) const
  169. {
  170.     int len = ::GetWindowTextLength(fHWnd);
  171.     char *windowText = new char[len + 1];
  172.     ::GetWindowText(fHWnd, windowText, len);
  173.     
  174.     text.ReplaceAll(windowText);
  175.     delete [] windowText;
  176. }
  177.  
  178. //----------------------------------------------------------------------------------------
  179. // FW_CPrivWinControlHelper::HWNDToHelper
  180. //----------------------------------------------------------------------------------------
  181.  
  182. FW_CPrivWinControlHelper* FW_CPrivWinControlHelper::HWNDToHelper(HWND hWnd)
  183. {
  184.     return (FW_CPrivWinControlHelper *) ::SendMessage(hWnd, WM_ODFGETOBJECT, 0, 0);
  185. }
  186.  
  187. //========================================================================================
  188. // CLASS FW_CPrivWinScrollBarHelper
  189. //========================================================================================
  190.  
  191. FW_SPrivWinSuperClassInfo FW_CPrivWinScrollBarHelper::fSuperClassInfo =
  192. {
  193.     "FW_SCROLLBAR", "SCROLLBAR", FW_CPrivWinScrollBarHelper::WindowProc, NULL, 0
  194. };
  195.  
  196. FW_DEFINE_CLASS_M1(FW_CPrivWinScrollBarHelper, FW_CPrivWinControlHelper)
  197.  
  198. //----------------------------------------------------------------------------------------
  199. // FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper
  200. //----------------------------------------------------------------------------------------
  201.  
  202. FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper(Environment* ev,
  203.                                                         const FW_CClassInfo& classInfo,
  204.                                                        FW_CScrollBar* scrollBar) :
  205.     FW_CPrivWinControlHelper(ev, classInfo, scrollBar)
  206. {
  207.     CheckForInitialize(ev, classInfo);
  208. }
  209.  
  210. //----------------------------------------------------------------------------------------
  211. // FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper
  212. //----------------------------------------------------------------------------------------
  213.  
  214. FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper()
  215. {
  216. }
  217.  
  218. //----------------------------------------------------------------------------------------
  219. // FW_CPrivWinScrollBarHelper::Initialize
  220. //----------------------------------------------------------------------------------------
  221.  
  222. void FW_CPrivWinScrollBarHelper::Initialize(Environment* ev)
  223. {
  224.     FW_CPrivWinControlHelper::Initialize(ev);
  225.     
  226.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetControl());
  227.     FW_ASSERT(scrollBar);
  228.     
  229.     SetScrollRange(FW_CScrollBar::kDefaultScrollMin, FW_CScrollBar::kDefaultScrollMax);
  230.     SetScrollPos(FW_CScrollBar::kDefaultScrollPos);
  231. }
  232.  
  233. //----------------------------------------------------------------------------------------
  234. // FW_CPrivWinScrollBarHelper::CreateHWnd
  235. //----------------------------------------------------------------------------------------
  236.  
  237. HWND FW_CPrivWinScrollBarHelper::CreateHWnd(HWND parent,
  238.                                             const FW_CPlatformPoint& location,
  239.                                             const FW_CPlatformPoint& size)
  240. {
  241.     DWORD orientation = size.x > size.y ? SBS_HORZ : SBS_VERT;
  242.     
  243. #ifdef FW_BUILD_WIN16
  244.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  245.                            location.x, location.y,
  246.                            size.x, size.y,
  247.                            parent, 100,
  248.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  249.                            this);
  250. #endif
  251.  
  252. #ifdef FW_BUILD_WIN32
  253.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  254.                            location.x, location.y,
  255.                            size.x, size.y,
  256.                            parent, 
  257.                            (HMENU)100,
  258.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  259.                            this);
  260. #endif
  261. }
  262.  
  263. //----------------------------------------------------------------------------------------
  264. // FW_CPrivWinScrollBarHelper::HandleScrollMessage
  265. //----------------------------------------------------------------------------------------
  266.  
  267. void FW_CPrivWinScrollBarHelper::HandleScrollMessage(WORD sbCode, WORD currentPosition)
  268. {
  269.     FW_SOMEnvironment ev;
  270.     
  271.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetControl());
  272.     FW_ASSERT(scrollBar);
  273.     
  274.     FW_Fixed changeBy = ff(0);
  275.  
  276.     switch (sbCode)
  277.     {
  278.         case SB_BOTTOM:
  279.             changeBy = scrollBar->GetScrollMax(ev) - ff(GetScrollPos());
  280.             break;
  281.         case SB_TOP:
  282.             changeBy = scrollBar->GetScrollMin(ev) - ff(GetScrollPos());
  283.             break;
  284.         case SB_LINEDOWN:
  285.             changeBy = scrollBar->GetMinorScrollUnits(ev);
  286.             break;
  287.         case SB_LINEUP:
  288.             changeBy = -scrollBar->GetMinorScrollUnits(ev);
  289.             break;
  290.         case SB_PAGEDOWN:
  291.             changeBy = scrollBar->GetMajorScrollUnits(ev);
  292.             break;
  293.         case SB_PAGEUP:
  294.             changeBy = -scrollBar->GetMajorScrollUnits(ev);
  295.             break;
  296.         case SB_THUMBPOSITION:
  297.             changeBy = ff(currentPosition - GetScrollPos());
  298.             break;
  299.     };
  300.     
  301.     FW_Fixed oldValue = ff(GetScrollPos()) - scrollBar->GetScrollMin(ev);
  302.     FW_Fixed newValue = oldValue + changeBy;
  303.     
  304.     if (newValue < scrollBar->GetScrollMin(ev))
  305.         newValue = scrollBar->GetScrollMin(ev);
  306.     else if (newValue > scrollBar->GetScrollMax(ev))
  307.         newValue = scrollBar->GetScrollMax(ev);
  308.     
  309.     newValue += scrollBar->GetScrollMin(ev);
  310.     
  311.     SetScrollPos(FixedToInt(newValue));
  312.     
  313.     scrollBar->ScrollPositionChanged(ev, newValue, newValue - oldValue);
  314. }
  315.  
  316. //----------------------------------------------------------------------------------------
  317. // FW_CPrivWinScrollBarHelper::GetSuperClassInfo
  318. //----------------------------------------------------------------------------------------
  319.  
  320. FW_SPrivWinSuperClassInfo& FW_CPrivWinScrollBarHelper::GetSuperClassInfo() const
  321. {
  322.     return fSuperClassInfo;
  323. }
  324.  
  325. //----------------------------------------------------------------------------------------
  326. // FW_CPrivWinScrollBarHelper::WindowProc
  327. //----------------------------------------------------------------------------------------
  328.  
  329. LRESULT CALLBACK FW_CPrivWinScrollBarHelper::WindowProc(HWND hWnd, UINT msg,
  330.                                                         WPARAM wParam, LPARAM lParam)
  331. {
  332.     switch (msg)
  333.     {
  334.         case WM_CREATE:
  335.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  336.                               hWnd, msg, wParam, lParam);
  337.             
  338.             // The FW_CPrivWinScrollBarHelper object is passed in to CreateWindow. Pull it
  339.             // out and stuff it in Window extra bytes.
  340.             
  341.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  342.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  343.             return 0L;
  344.             
  345.         case WM_PAINT:
  346.             break;
  347.             
  348.         case WM_DESTROY:
  349.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  350.             break;
  351.         
  352.         default:
  353.             // Get the Window extra bytes, which is the FW_CPrivWinScrollBarHelper object
  354.             // for this window, and return it.
  355.             
  356.             if (msg == WM_ODFGETOBJECT)
  357.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  358.     }
  359.  
  360.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  361.                              hWnd, msg, wParam, lParam);    
  362. }
  363.  
  364. //========================================================================================
  365. // CLASS FW_CPrivWinButtonHelper
  366. //========================================================================================
  367.  
  368. FW_SPrivWinSuperClassInfo FW_CPrivWinButtonHelper::fSuperClassInfo =
  369. {
  370.     "FW_BUTTON", "BUTTON", FW_CPrivWinButtonHelper::WindowProc, NULL, 0
  371. };
  372.  
  373. FW_DEFINE_CLASS_M1(FW_CPrivWinButtonHelper, FW_CPrivWinControlHelper)
  374.  
  375. //----------------------------------------------------------------------------------------
  376. // FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper
  377. //----------------------------------------------------------------------------------------
  378.  
  379. FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper(Environment* ev,
  380.                                                 const FW_CClassInfo& classInfo,
  381.                                                  FW_CButton* button) :
  382.     FW_CPrivWinControlHelper(ev, classInfo, button)
  383. {
  384.     CheckForInitialize(ev, classInfo);
  385. }
  386.  
  387. //----------------------------------------------------------------------------------------
  388. // FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper
  389. //----------------------------------------------------------------------------------------
  390.  
  391. FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper()
  392. {
  393. }
  394.  
  395. //----------------------------------------------------------------------------------------
  396. // FW_CPrivWinButtonHelper::GetSuperClassInfo
  397. //----------------------------------------------------------------------------------------
  398.  
  399. FW_SPrivWinSuperClassInfo& FW_CPrivWinButtonHelper::GetSuperClassInfo() const
  400. {
  401.     return fSuperClassInfo;
  402. }
  403.  
  404. //----------------------------------------------------------------------------------------
  405. // FW_CPrivWinButtonHelper::WindowProc
  406. //----------------------------------------------------------------------------------------
  407.  
  408. LRESULT CALLBACK FW_CPrivWinButtonHelper::WindowProc(HWND hWnd, UINT msg,
  409.                                                      WPARAM wParam, LPARAM lParam)
  410. {
  411.     switch (msg)
  412.     {
  413.         case WM_CREATE:
  414.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  415.                               hWnd, msg, wParam, lParam);
  416.             
  417.             // The FW_CPrivWinPushButtonHelper object is passed in to CreateWindow. Pull it
  418.             // out and stuff it in Window extra bytes.
  419.             
  420.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  421.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  422.             return 0L;
  423.             
  424.         case WM_PAINT:
  425.             break;
  426.             
  427.         case WM_DESTROY:
  428.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  429.             break;
  430.         
  431.         default:
  432.             // Get the Window extra bytes, which is the FW_CPrivWinPushButtonHelper object
  433.             // for this window, and return it.
  434.             
  435.             if (msg == WM_ODFGETOBJECT)
  436.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  437.     }
  438.  
  439.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  440.                              hWnd, msg, wParam, lParam);    
  441. }
  442.  
  443. //========================================================================================
  444. // CLASS FW_CPrivWinPushButtonHelper
  445. //========================================================================================
  446.  
  447. FW_DEFINE_CLASS_M1(FW_CPrivWinPushButtonHelper, FW_CPrivWinButtonHelper)
  448.  
  449. //----------------------------------------------------------------------------------------
  450. // FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper
  451. //----------------------------------------------------------------------------------------
  452.  
  453. FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper(Environment* ev,
  454.                                                          const FW_CClassInfo& classInfo,
  455.                                                          FW_CPushButton* button) :
  456.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  457. {
  458.     CheckForInitialize(ev, classInfo);
  459. }
  460.  
  461. //----------------------------------------------------------------------------------------
  462. // FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper
  463. //----------------------------------------------------------------------------------------
  464.  
  465. FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper()
  466. {
  467. }
  468.  
  469. //----------------------------------------------------------------------------------------
  470. // FW_CPrivWinPushButtonHelper::CreateHWnd
  471. //----------------------------------------------------------------------------------------
  472.  
  473. HWND FW_CPrivWinPushButtonHelper::CreateHWnd(HWND parent,
  474.                                              const FW_CPlatformPoint& location,
  475.                                              const FW_CPlatformPoint& size)
  476. {
  477. #ifdef FW_BUILD_WIN16
  478.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  479.                            location.x, location.y,
  480.                            size.x, size.y,
  481.                            parent, 100,
  482.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  483.                            this);
  484. #endif 
  485.  
  486. #ifdef FW_BUILD_WIN32
  487.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  488.                            location.x, location.y,
  489.                            size.x, size.y,
  490.                            parent, 
  491.                            (HMENU)100,
  492.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  493.                            this);
  494. #endif 
  495. }
  496.  
  497. //----------------------------------------------------------------------------------------
  498. // FW_CPrivWinPushButtonHelper::MakeDefaultButton
  499. //----------------------------------------------------------------------------------------
  500.  
  501. void FW_CPrivWinPushButtonHelper::MakeDefaultButton(FW_Boolean isDefault)
  502. {
  503.     unsigned long dwStyle = (unsigned long)(::GetWindowLong(fHWnd, GWL_STYLE));
  504.  
  505.     if (isDefault)                            // Make sure the button's style has BS_DEFPUSHBUTTON
  506.     {
  507.         if ((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON)
  508.             return;
  509.  
  510.         dwStyle |= BS_DEFPUSHBUTTON;
  511.     }
  512.     else                                    // Make sure the button's style doesn't have
  513.         {                                    // BS_DEFPUSHBUTTON
  514.  
  515.             if (!((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON))
  516.                 return;
  517.  
  518.             dwStyle &= ~BS_DEFPUSHBUTTON;
  519.         }
  520.  
  521.     ::SetWindowLong(fHWnd, GWL_STYLE, dwStyle);
  522. }
  523. //----------------------------------------------------------------------------------------
  524. // FW_CPrivWinPushButtonHelper::HandleButtonMessage
  525. //----------------------------------------------------------------------------------------
  526.  
  527. void FW_CPrivWinPushButtonHelper::HandleButtonMessage()
  528. {
  529.     FW_SOMEnvironment ev;
  530.     FW_CPushButton* button = FW_DYNAMIC_CAST(FW_CPushButton, GetControl());
  531.     FW_ASSERT(button);
  532.     
  533.     button->ButtonPressed(ev);
  534. }
  535.  
  536. //========================================================================================
  537. // CLASS FW_CPrivWinRadioButtonHelper
  538. //========================================================================================
  539.  
  540. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioButtonHelper, FW_CPrivWinButtonHelper)
  541.  
  542. //----------------------------------------------------------------------------------------
  543. // FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper
  544. //----------------------------------------------------------------------------------------
  545.  
  546. FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper(Environment* ev,
  547.                                                             const FW_CClassInfo& classInfo,
  548.                                                              FW_CRadioButton* button) :
  549.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  550. {
  551.     CheckForInitialize(ev, classInfo);
  552. }
  553.  
  554. //----------------------------------------------------------------------------------------
  555. // FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper
  556. //----------------------------------------------------------------------------------------
  557.  
  558. FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper()
  559. {
  560. }
  561.  
  562. //----------------------------------------------------------------------------------------
  563. // FW_CPrivWinRadioButtonHelper::CreateHWnd
  564. //----------------------------------------------------------------------------------------
  565.  
  566. HWND FW_CPrivWinRadioButtonHelper::CreateHWnd(HWND parent,
  567.                                              const FW_CPlatformPoint& location,
  568.                                              const FW_CPlatformPoint& size)
  569. {
  570. #ifdef FW_BUILD_WIN16
  571.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  572.                            location.x, location.y,
  573.                            size.x, size.y,
  574.                            parent, 100,
  575.                            ::GetWindowWord(parent, GWW_HINSTANCE), 
  576.                            this);
  577. #endif
  578. #ifdef FW_BUILD_WIN32
  579.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  580.                            location.x, location.y,
  581.                            size.x, size.y,
  582.                            parent, 
  583.                            (HMENU)100,
  584.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  585.                            this);
  586. #endif
  587. }
  588.  
  589. //----------------------------------------------------------------------------------------
  590. // FW_CPrivWinRadioButtonHelper::HandleButtonMessage
  591. //----------------------------------------------------------------------------------------
  592.  
  593. void FW_CPrivWinRadioButtonHelper::HandleButtonMessage()
  594. {
  595.     FW_SOMEnvironment ev;
  596.     FW_CRadioButton* button = FW_DYNAMIC_CAST(FW_CRadioButton, GetControl());
  597.     FW_ASSERT(button);
  598.     
  599.     button->ButtonPressed(ev);
  600. }
  601.  
  602. //========================================================================================
  603. // CLASS FW_CPrivWinRadioClusterHelper
  604. //========================================================================================
  605.  
  606. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioClusterHelper, FW_CPrivWinButtonHelper)
  607.  
  608. //----------------------------------------------------------------------------------------
  609. // FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper
  610. //----------------------------------------------------------------------------------------
  611.  
  612. FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper(Environment* ev,
  613.                                                             const FW_CClassInfo& classInfo,
  614.                                                              FW_CRadioButton* button) :
  615.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  616. {
  617.     CheckForInitialize(ev, classInfo);
  618. }
  619.  
  620. //----------------------------------------------------------------------------------------
  621. // FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper
  622. //----------------------------------------------------------------------------------------
  623.  
  624. FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper()
  625. {
  626. }
  627.  
  628. //----------------------------------------------------------------------------------------
  629. // FW_CPrivWinRadioClusterHelper::CreateHWnd
  630. //----------------------------------------------------------------------------------------
  631.  
  632. HWND FW_CPrivWinRadioClusterHelper::CreateHWnd(HWND parent,
  633.                                              const FW_CPlatformPoint& location,
  634.                                              const FW_CPlatformPoint& size)
  635. {
  636. #ifdef FW_BUILD_WIN16
  637.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  638.                            location.x, location.y,
  639.                            size.x, size.y,
  640.                            parent, 100,
  641.                            ::GetWindowWord(parent, GWW_HINSTANCE), this);
  642. #endif
  643. #ifdef FW_BUILD_WIN32
  644.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  645.                            location.x, location.y,
  646.                            size.x, size.y,
  647.                            parent, 
  648.                            (HMENU)100,
  649.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  650.                            this);
  651. #endif
  652. }
  653.  
  654. //----------------------------------------------------------------------------------------
  655. // FW_CPrivWinRadioClusterHelper::HandleButtonMessage
  656. //----------------------------------------------------------------------------------------
  657.  
  658. void FW_CPrivWinRadioClusterHelper::HandleButtonMessage()
  659. {
  660.     FW_CRadioCluster* button = FW_DYNAMIC_CAST(FW_CRadioCluster, GetControl());
  661.     FW_ASSERT(button);
  662.     
  663. //    button->ButtonPressed();
  664. }
  665.  
  666. #endif
  667.